
<?php include_once 'common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/system_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
	<div class="admin_right_title"><strong>系统管理</strong> >> 管理员类型</div>
		<div class="admin_right_con">
			<?php if(isset($admin['type_id']) && $admin['type_id'] !=1){?>
			<div class="Prompt">
			    <div class="Prompt_top"></div>
			  	<div class="Prompt_con">
				    <dl>
				      <dt>提示信息</dt>
				      <dd><span class="Prompt_x"></span></dd>
				      <dd><h2 style="color:red">对不起，权限不足</h2></dd>
				    </dl>
			    </div>
			    <div class="Prompt_btm"></div>
		  </div>
			<?php }else{?>
			<div style="height:30px;line-height:30px;">
			<a class="addtr" href="/ychadmin/systemadmin/admin_type_add_view/">添加管理员类型</a>
			</div>
			<table border="0" cellspacing="1" cellpadding="0" bgcolor="#cfe6f4">
			  <tr style="color:#0068b7;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>ID</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>类型名称</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1" style="width:71%"><strong>管理模块</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>添加时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($type_list as $key=>$type){?>
			  <tr id="row_<?php echo $type['id'];?>">
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $type['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $type['name'];?></td>
				<td height="35" align="left" valign="middle" bgcolor="#FFFFFF">
				<?php
				$type_arr = explode(',',$type['module']);
				foreach ($admintype as $k=>$v){
					foreach($v['list'] as $lk => $lv){
						foreach($lv['sonlist'] as $sk =>$sv){
							if(array_key_exists(array_search($sk,$type_arr),$type_arr)){
								$mlist .= $sv['linkname']." | ";
							}
						}
					}
				}
				echo substr($mlist,0,-1);
				unset($mlist);
				?>
				</td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d H:i',$type['addtime']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $type['status']==1?"开通":"关闭";?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="/ychadmin/systemadmin/admin_type_edit_view/<?php echo $type['id'];?>">修改</a>  |<a href="javascript:if(confirm('确定删除？')){remove(<?php echo $type['id'];?>);}">删除</a></td>
			  </tr>
			  <?php }?>
			  <tr>
			  <td colspan="6"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			  <?php }?>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<script>
function remove(id){
	$.ajax({
		type: "post",
		url: "/ychadmin/systemadmin/admin_type_del/",
		data: "id="+id,
		success: function(msg){
			$("#dialog" ).dialog();
			if(msg == 1){
				$("#msg").html("删除成功！");
				$("#row_"+id).hide();
			}else{
				$("#msg").html("删除失败，请联系管理员！");
			}
			setTimeout(function(){
				$("#dialog" ).dialog("close");
			},3000);
		},
		dataType: "text"
	});
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>
